home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / Tools / Text-Viewer / MSWordView / mswordview_src / formatting.c < prev    next >
C/C++ Source or Header  |  2000-05-08  |  2KB  |  77 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include "config.h"
  6. #include "mswordview.h"
  7.  
  8. extern FILE *erroroutput;
  9. extern FILE *outputfile;
  10. extern int breakcount;
  11. extern int verpadding;
  12.  
  13. int flushbreaks(int newpap)
  14.     {
  15.     int silent=0,i;
  16.     error(erroroutput,"flushing breaks %d\n",breakcount);
  17.  
  18.     if (breakcount == 1)
  19.         oprintf(silent,"<br>\n");
  20.     else if (breakcount > 1)
  21.         {
  22.         if (verpadding == 1)
  23.             {
  24.             for (i=0;i<breakcount;i++)
  25.                 oprintf(silent,"<br>\n");
  26.             }
  27.         else
  28.             {
  29.             oprintf(silent,"<p>\n");
  30.             if (verpadding != 2)
  31.                 if (breakcount > 2)
  32.                     for (i=2;i<breakcount;i++)
  33.                         oprintf(silent,"<br>\n");
  34.             }
  35.         }
  36.     else
  37.         return 0;
  38.     breakcount=0;
  39.     return 1;
  40.     }
  41.  
  42.  
  43. void do_indent(pap *apap)
  44.     {
  45.     S16 paraindent;
  46.     static int oldparaindent;
  47.     int i;
  48.     error(erroroutput,"the left margin is %d twirps\n",apap->leftmargin);
  49.  
  50.     if (apap == NULL)
  51.         return;
  52.  
  53.     paraindent = apap->leftmargin;
  54.     paraindent /= TWIRPS_PER_BQ;
  55.     error(erroroutput,"no of dirs is %d\n",paraindent);
  56.     if (paraindent < 0)
  57.         paraindent = 0;
  58.  
  59.     if (paraindent < oldparaindent)
  60.         {
  61.         for(i=paraindent;i<oldparaindent;i++)
  62.             fprintf(outputfile,"\n</dir>");
  63.         }
  64.     else if (paraindent > oldparaindent)
  65.         {
  66.         for (i=oldparaindent;i<paraindent;i++)
  67.             fprintf(outputfile,"\n<dir>");
  68.         }
  69.     oldparaindent = paraindent;
  70.     if (apap->firstline >0)
  71.         {
  72.         fprintf(outputfile,"<img height=1 width=%d src=\"%s/clear.gif\">",apap->firstline/TWIRPS_PER_H_PIXEL,patterndir());
  73.         }
  74.     }
  75.  
  76.  
  77.